<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>日志管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
		function dataForm(logId){
			var url = "${ctx}/sys/securityLog/form?id="+logId;
			top.$.jBox.open("iframe:"+url, "日志详情",810,$(top.document).height()-120,{
                buttons:{"关闭":true}, bottomText:"日志详情",submit:function(v, h, f){
                }, loaded:function(h){
                    $(".jbox-content", top.document).css("overflow-y","hidden");
                }
            });
		}
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/sys/securityLog/">日志列表</a></li>
		<shiro:hasPermission name="sys:securityLog:edit"><li><a href="${ctx}/sys/securityLog/form">日志添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="securityLog" action="${ctx}/sys/securityLog/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li>
				<label>模块名称：</label>
				<input type="text" name="moduleName" value="${securityLog.moduleName}" class="input-medium"/>
			</li>
			<li><label>模块：</label>
				<select name="module" class="input-medium" data-value="${securityLog.module}">
					<option value="">---请选择---</option>
					<option value="1" <c:if test="${securityLog.module==1}">selected</c:if>>用户</option>
					<option value="2" <c:if test="${securityLog.module==2}">selected</c:if>>角色</option>
				</select>
			</li>
			<li><label>操作类型：</label>
				<select name="type" class="input-medium" data-value="${securityLog.type}">
					<option value="">---请选择---</option>
					<option value="1" <c:if test="${securityLog.type==1}">selected</c:if>>新增用户</option>
					<option value="2" <c:if test="${securityLog.type==2}">selected</c:if>>停用用户</option>
					<option value="3" <c:if test="${securityLog.type==3}">selected</c:if>>赋予权限</option>
					<option value="4" <c:if test="${securityLog.type==4}">selected</c:if>>分配用户</option>
					<option value="5" <c:if test="${securityLog.type==5}">selected</c:if>>赋予角色</option>
				</select>
			</li>
			<li><label>创建时间从：</label>
   				<input name="dateFrom" id="startTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
   					value="${securityLog.dateFrom}"
   					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true,maxDate:'#F{$dp.$D(\'endTime\')}'});"/>
   			</li>
   			<li><label>创建时间到：</label>
   				<input name="dateTo" id="endTime" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
   					value="${securityLog.dateTo}"
   					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true,minDate:'#F{$dp.$D(\'startTime\')}'});"/>
   			</li>
   			<li><label>操作人：</label>
   				<sys:treeselect id="manager" name="createBy.id" value="${securityLog.createBy.id}" labelName="createBy.name" labelValue="${securityLog.createBy.name}"
    					title="用户" url="/sys/office/treeData?type=3" cssClass="input-small" allowClear="true" notAllowSelectParent="true"/>
   			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>模块</th>
				<th>模块名称</th>
				<th>操作</th>
				<th>数据摘要</th>
				<th>操作时间</th>
				<th>操作人</th>
				<shiro:hasPermission name="sys:securityLog:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="securityLog">
			<tr>
				<td>
					<c:choose>
						<c:when test="${securityLog.module==1}">
							用户
						</c:when>
						<c:when test="${securityLog.module==2}">
							角色
						</c:when>
					</c:choose>
				</td>
				<td>
					<c:choose>
						<c:when test="${securityLog.type == 1||securityLog.type == 3}">
							<a href="javascript:void(0);" onclick="dataForm('${securityLog.id}');">
								${securityLog.moduleName}
							</a>
						</c:when>
						<c:otherwise>
							${securityLog.moduleName}
						</c:otherwise>
					</c:choose>
				</td>
				<td>
					<c:choose>
						<c:when test="${securityLog.type==1}">
							新增
						</c:when>
						<c:when test="${securityLog.type==2}">
							停用
						</c:when>
						<c:when test="${securityLog.type==3}">
							赋予权限
						</c:when>
						<c:when test="${securityLog.type==4}">
							分配用户
						</c:when>
						<c:when test="${securityLog.type==5}">
							赋予角色
						</c:when>
					</c:choose>
				</td>
				<td>
					<c:if test="${securityLog.type==4||securityLog.type==5}">
						${securityLog.data}
					</c:if>
				</td>
				<td>
					<fmt:formatDate value="${securityLog.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					${securityLog.createBy.name}
				</td>
				<shiro:hasPermission name="sys:securityLog:edit"><td>
    				<a href="${ctx}/sys/securityLog/form?id=${securityLog.id}">修改</a>
					<a href="${ctx}/sys/securityLog/delete?id=${securityLog.id}" onclick="return confirmx('确认要删除该日志吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>